package com.inibb.app.sftp.impl.jsch;



import com.inibb.app.sftp.SFTPAuthInfo;
import com.jcraft.jsch.UserInfo;
/**
 * <p>Descriition: ssh user infomation ,this class used by JschSFTPConnection </p>
 * <p>Created by Nick.HT.Chu </p>
 * <p>Create Date 2006-6-16 14:24  </P>
 */

public class SSHUserInfo implements UserInfo {
	SFTPAuthInfo authInfo;
	
	SSHUserInfo(SFTPAuthInfo authInfo) {
		this.authInfo = authInfo;
	}
	
	public String getPassphrase() {
		return null;
	}

	public String getPassword() {
		if (authInfo.getSshKeyFile()==null) {
			char[] pwd = authInfo.getPassphrase();
			if (pwd==null) return "";
			else return new String(authInfo.getPassphrase());
		} else {
			return null;
		}
	}

	public boolean promptPassword(String message) {
		return true;
	}

	public boolean promptPassphrase(String message) {
		return true;
	}

	public boolean promptYesNo(String message) {
		/*
		Object[] options = { "yes", "no" };
		int foo = JOptionPane.showOptionDialog(null, message, "Warning",
				JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
				null, options, options[0]);
		return foo == 0;*/
		return true;
	}

	public void showMessage(String message) {
		//JOptionPane.showMessageDialog(null, message);

	}

}
